package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "Delivery_schedule_details", schema = "CRM", catalog = "")
public class DeliveryScheduleDetails {
    private long dsdId;
    private String dsdRoductName;
    private String dsdCompany;
    private Long dsdMoney;
    private Long dsdNumber;
    private String dsdSize;
    private String dsdColor;
    private DeliveryPlan deliveryPlanByPlanId;

    @Id
    @Column(name = "dsd_id")
    @GeneratedValue(generator = "seq",strategy = GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name = "seq",sequenceName = "crm",
            initialValue = 1,allocationSize = 1)
    public long getDsdId() {
        return dsdId;
    }

    public void setDsdId(long dsdId) {
        this.dsdId = dsdId;
    }

    @Basic
    @Column(name = "dsd_roduct_name")
    public String getDsdRoductName() {
        return dsdRoductName;
    }

    public void setDsdRoductName(String dsdRoductName) {
        this.dsdRoductName = dsdRoductName;
    }

    @Basic
    @Column(name = "dsd_company")
    public String getDsdCompany() {
        return dsdCompany;
    }

    public void setDsdCompany(String dsdCompany) {
        this.dsdCompany = dsdCompany;
    }

    @Basic
    @Column(name = "dsd_money")
    public Long getDsdMoney() {
        return dsdMoney;
    }

    public void setDsdMoney(Long dsdMoney) {
        this.dsdMoney = dsdMoney;
    }

    @Basic
    @Column(name = "dsd_number")
    public Long getDsdNumber() {
        return dsdNumber;
    }

    public void setDsdNumber(Long dsdNumber) {
        this.dsdNumber = dsdNumber;
    }

    @Basic
    @Column(name = "dsd_size")
    public String getDsdSize() {
        return dsdSize;
    }

    public void setDsdSize(String dsdSize) {
        this.dsdSize = dsdSize;
    }

    @Basic
    @Column(name = "dsd_color")
    public String getDsdColor() {
        return dsdColor;
    }

    public void setDsdColor(String dsdColor) {
        this.dsdColor = dsdColor;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeliveryScheduleDetails that = (DeliveryScheduleDetails) o;
        return dsdId == that.dsdId &&
                Objects.equals(dsdRoductName, that.dsdRoductName) &&
                Objects.equals(dsdCompany, that.dsdCompany) &&
                Objects.equals(dsdMoney, that.dsdMoney) &&
                Objects.equals(dsdNumber, that.dsdNumber) &&
                Objects.equals(dsdSize, that.dsdSize) &&
                Objects.equals(dsdColor, that.dsdColor);
    }

    @Override
    public int hashCode() {
        return Objects.hash(dsdId, dsdRoductName, dsdCompany, dsdMoney, dsdNumber, dsdSize, dsdColor);
    }

    @ManyToOne
    @JoinColumn(name = "plan_id", referencedColumnName = "plan_id")
    public DeliveryPlan getDeliveryPlanByPlanId() {
        return deliveryPlanByPlanId;
    }

    public void setDeliveryPlanByPlanId(DeliveryPlan deliveryPlanByPlanId) {
        this.deliveryPlanByPlanId = deliveryPlanByPlanId;
    }
}
